import { post } from '@/request/http'
import store from '@/store'
import { toString } from '@/utils/utils'
/**
 *
 *  1. 查询港口
 */

export const selectTmPortsInfos = ({potCname,//港口代码
  potCd,//港口中文名
  potEname,//港口英文名
  potCtyCd,//国家代码
  PageSizes,
  PageIndexs,

} )=>
  post(
    '/FTKJWLHYPT/base/selectTmPortsInfos',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {potCd,potCname,potEname,potCtyCd,
            potDptId:store.state.user.DPTID_DX_H==='-1'?'':toString(store.state.user.DPTID_DX_H),
            potFltId:toString(store.state.user.FLT_UUID_DX_H) //车队id
          }
        },
        Orderbys: {},
        PageIndexs: {
          FTKJWLHYPT: PageIndexs
        },
        PageSizes: {
          FTKJWLHYPT: PageSizes
        }
      }
    }
  )
//港口添加

export const addTmPortsInfo = ({
  potCd,potCname,potEname,potCtyCd,potPrvCode,potEdicode,potIsvalid,potRemark,potX,potY,potCtyeCode
}) =>
  post(
    '/FTKJWLHYPT/base/addTmPortsInfo',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {potCd,
            potCname,
            potEname,
            potInsertuser:store.state.user.USR_CODE_DX_H,potCtyCd,
            potPrvCode,
            potDptId:store.state.user.DPTID_DX_H,
            // potDptId:1,
            potEdicode,
            potIsvalid,
            potRemark,
            potX,
            potY,

            potCtyeCode,
            potFltId:store.state.user.FLT_UUID_DX_H //车队id
          }
        }
      }
    }
  )

//港口修改
export const updateTmPortsInfo = ({
  potCd,potCname,potEname,potCtyCd,potPrvCode,potEdicode,potIsvalid,potRemark,potX,potY,potCtyeCode
}) =>
  post(
    '/FTKJWLHYPT/base/updateTmPortsInfo',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {potCd,potCname,potEname,
            potLstupduser:store.state.user.USR_CODE_DX_H,
            potCtyCd,
            potEdicode,
            potIsvalid,
            potRemark,
            potX,
            potY,
            // potEport,
            potCtyeCode,
            potPrvCode,
            potDptId:store.state.user.DPTID_DX_H,
            potFltId:store.state.user.FLT_UUID_DX_H //车队id
          }
        }
      }
    }
  )

//删除港口
export const delPortMag = potCd =>
  post(
    '/FTKJWLHYPT/base/deleteTmPortsInfo',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {potCd //港口代码
          }

        }
      }
    }
  )


